Conversation
Taken from mkosi, using the common systemd line length.
jelly
left a comment
There was a problem hiding this comment.
Overall this looks good, I'll need to get used to ruff format as I've always used different kinds of quotes at times and I am not a super huge fan of:
self.call_this_thing(
foo,
bar,
)But that doesn't feel bad enough to nack this.
After all these changes we should be able to run ruff check in CI as well now right? Locally I see some failures with:
E722 and maybe more as I didn't check out this branch with extra rules enabled yet. But I'm happy to ignore some specific rules which we can clean up later.
Not all files have them, they are inconsistent in style and Python 3 defaults to UTF-8 anyway.
This removes unused imports and empty constructor calls for constants.
Silence the warning for overly long lines and the warnings for direct comparions with bools (E712). The latter *cannot* be fixed by using the bare values, as is recommended and needs investigation in the future.
Bare except catches BaseException, which includes SystemExit and KeyboardInterrupt. This is probably not intended in the places where this is used. Instead except Exception instead, which all "normal" exceptions derive from. Where possible use the correct exception, use exception-free code or annotate a more likely exception for the future.
I hadn't done that yet, because those the bare excepts needed a real look at this. I silenced the minor warnings in one commit and fixed the bare commits in another (hopefully), so that we can add the ruff check right away.
Yeah, it definitely takes some getting used to, but it has the upside of making diffs much more localized and smaller. That's what sold me on it. |
|
Lest I forgot the second commit in the series changed, because I also reformatted |
The ruff commits in order
ruff formatand can be recreated from thatruff formatcheck to CIThe rest is cleanup, mostly around string formatting.